import request from '@/utils/request'

// 查询类别代码列表
export function listLbm(query) {
  return request({
    url: '/project/lbm/list',
    method: 'get',
    params: query
  })
}

// 查询类别代码详细
export function getLbm(lbmId) {
  return request({
    url: '/project/lbm/' + lbmId,
    method: 'get'
  })
}

// 新增类别代码
export function addLbm(data) {
  return request({
    url: '/project/lbm',
    method: 'post',
    data: data
  })
}


// 批量新增类别代码
export function batchAdd(data) {
  return request({
    url: '/project/lbm/batchAdd',
    method: 'post',
    data: data
  })
}

// 修改类别代码
export function updateLbm(data) {
  return request({
    url: '/project/lbm',
    method: 'put',
    data: data
  })
}

//批量修改
export function batchUpdateLbm(data) {
  return request({
    url: '/project/lbm/batchUpdate',
    method: 'put',
    data: data
  })
}

// 删除类别代码
export function delLbm(lbmId,bmyz,flag) {
  return request({
    url: '/project/lbm/' + lbmId+'/'+bmyz+'/'+flag,
    method: 'delete'
  })
}


// 删除类别代码123
export function batchDelete(data) {
  return request({
    url: '/project/lbm/batchDelete',
    method: 'delete',
    data: data
  })
}

// 导出类别代码
export function exportLbm(query) {
  return request({
    url: '/project/lbm/export',
    method: 'get',
    params: query
  })
}

export function getAreaTree(parentId){

  return request({
    url: '/project/lbm/getChild/' + parentId,
    method: 'get'
  })

}

export function getFirstNode(){

  return request({
    url: '/project/lbm/getFirstNode' ,
    method: 'get'
  })


}
//修改状态
export function changBlmFlag(blmId,blmFlag){
  const data = {
    blmId,
    blmFlag
  }
  return request({
    url: '/project/blm',
    method: 'put',
    data: data
  })
}

//向后台绑定数据
export function bindStorageForLbm(query) {

  return request({
    url: '/project/bm/bindStorageForLbm',
    method: 'put',
    data: query
  })

}
